#!/usr/bin/python
#-*- coding: UTF-8 -*-
# Django settings for icq project.
from django.conf import settings
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from django.views.static import serve
from django.contrib import admin
from django.contrib.auth.views import login, logout

admin.autodiscover()

urlpatterns = patterns('',
                       url(r'^admin/', include(admin.site.urls)),
                       url(r'^accounts/login/$','django.contrib.auth.views.login',{'template_name':'admin/login.html'}),
                       url(r'^accounts/logout/$', logout),
                       )
#静态文件
urlpatterns += patterns('icq.traffic_statistics.views',
                        url(r'^static/(?P<path>.*)$', serve,
                                {'document_root': settings.STATIC_ROOT_ICQ, 'show_indexes': True}),
                        url(r'^p/$', direct_to_template, {'template': 'generic/admin/base.html'}),
                        )

#流量统计
urlpatterns += patterns('icq.traffic_statistics.views',
                        url(r'^ts/$', 'dashborad'), #整站
                        url(r'^ts/c/$', 'channel_total'), #频道汇总
                        url(r'^ts/g/$', 'group_total'), #频道汇总
                        url(r'^ts/pv/$', 'pv_top100'), #事业部汇总
                        url(r'^ts/refer/$', 'refer_top100'), #事业部汇总
                        url(r'^ts/d/$', 'department_all'), #事业部汇总
                        url(r'^ts/d/(\d)/$', 'department_single'), #按各个事业部
                        # url(r'^ts/department/(?P<year>\d{4})/$', 'department_total'),
                        #url(r'^ts/department/(?P<year>\d{4})/(?P<month>\d{2})/$', 'department_total'),
                        #url(r'^ts/department/(?P<year>\d{4})/(?P<month>\d{2})/$(?P<day>\d{2})/', 'department_total'),
)
#debug 1
#if settings.DEBUG:
#    urlpatterns += patterns('',
#                            (),
#                            )
